package net.oschina.app.fragment;

import android.support.v4.app.Fragment;

import net.oschina.app.R;
import net.oschina.app.util.UIUtils;

/**
 * Created by YL on 2017/4/1.
 */
public class FragmentFactory {
    public static Fragment createFragment(int position){
        //value/strings下的fragment的全类名数组
        String[] fragments = UIUtils.getStrings(R.array.favorite_fragment);
        BaseFragment fragment = null;
        try {
            Class<?> aClass = Class.forName(fragments[position]);
            fragment = (BaseFragment) aClass.newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return fragment;
    }


    public static Fragment createMsgFragment(int position) {
        return null;
    }
}
